home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
comms
/
other
/
ums
/
rexx
/
groupcontents.rexx
next >
Wrap
OS/2 REXX Batch file
|
1999-06-14
|
4KB
|
135 lines
/* ------------------------------------------------------------------------
:Program. GroupContents
:Contents. shows contents of one group in UMS' messagebase
:Author. Kai Bolay [kai]
:Address. Hoffmannstraße 168
:Address. D-71229 Leonberg
:EMail. kai@studbox.uni-stuttgart.de
:Version. $VER: GroupContents.rexx 2.1 (11.11.95)
:Copyright. Public Domain
:Language. ARexx
:Translator. RexxMast
$Id: GroupContents.rexx 2.1 1995/11/11 12:11:08 kai Exp $
$Log: GroupContents.rexx $
# Revision 2.1 1995/11/11 12:11:08 kai
# v1.0 [kai] 23-Sep-93
# v1.1 [mh] 26-Sep-93 adaped to skeleton
# v1.2 [kai] 29-Sep-93 no skeleton, added MakeFlags()
# v1.3 [hG] 16-Jan-94 improofed argument parsing,
# added option NoUpdate
# v1.4 [hG] 23-Jan-94 uses UMSInit.rexx 1.1 and
# hgRexxSupport.library
# v2.0 [kai] 21-Dec-94 adapted to UMS v11
# v2.1 [kai] 11-Nov-95 adapted to newest standard
#
------------------------------------------------------------------------ */
/*** Startup ***/
options results
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on ERROR
signal on HALT
signal on IOERR
signal on SYNTAX
/*** Init ***/
call addlib("rexxdossupport.library", 0, -30)
call addlib("ums.library", 0, -210, 11)
call UMSInitConsts()
/*** Arguments ***/
parse SOURCE . " " . " " ProgramName .
ArgsTemplate = "NAME/A,PASSWORD,SERVER/K,GROUP/A"
args.SERVER = ""
args.PASSWORD = ""
parse arg arguments
if strip(arguments) = '?' then do
call writech(STDOUT, ArgsTemplate || ': ')
arguments = readln(STDIN)
end; else nop
if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
say Fault(RC, ProgramName)
exit 10
end; else nop
/*** Login ***/
account = UMSLogin(args.name, args.password, args.server)
if account = 0 then do
say "unable to login."
exit 10
end
/*** Do the magic ***/
/* clear local flags 0, 1 and 2 on all messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(), UMSMakeFlags(0, 1, 2),,, "LOCAL", UMSMakeFlags(), UMSMakeFlags())
/* set local flag 1 on all messages of this group */
res = UMSSelectField(account, "LOCAL", UMSMakeFlags(1), UMSMakeFlags(),,, UMSCODE_Group, args.group, TRUE)
/* set local flag 2 on all accessable messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(2), UMSMakeFlags(),,, "USER", UMSMakeFlags(UMSUSTAT_ReadAccess), UMSMakeFlags(UMSUSTAT_ReadAccess))
/* set local flag 0 on all messages with flag 1 AND flag 2 set */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, "LOCAL", UMSMakeFlags(1, 2), UMSMakeFlags(1, 2))
last = 0
do forever
/* find next message with flag 0 set */
last = UMSSearchFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(0), last)
if last = 0 then leave
drop msg. /* _IMPORTANT_ */
if ~UMSReadMsgField(account, last, msg., UMSCODE_FromName, TRUE) | ~UMSReadMsgField(account, last, msg., UMSCODE_Subject, TRUE) then do
call CheckErr
RC = 20; call LOGOUT
end
say right(last, 5, " ") left(msg.UMSCODE_FromName, 20) left(msg.UMSCODE_Subject, 40)
end
/*** Final cleanup ***/
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
RC = 0
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
SAY "Error: " rc errortext(rc) "Line" sigl
RC = 20
END
/*** Logout ***/
LOGOUT:
if account ~= 0 then do
call UMSLogout(account)
account = 0
end
exit RC
/*** Support ***/
CheckErr: procedure expose account
err = UMSErrNum(account)
if err ~= 0 then do
say "UMS Error #" || err || ": " || UMSErrTxt(account)
end
return